package com.tedu.day04mybatis.mapper;

import com.tedu.day04mybatis.pojo.Weibo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WeiBoMapper {
    @Insert("insert into weibo(content,created,user_id) values(#{content},#{created},#{userId})")
    int insert(Weibo weibo);

    @Delete("delete from weibo where id=#{id}")
    int deleteById(Integer id);

    @Update("update weibo set content=#{content},created=#{created}where id=#{id}")
    int update(Weibo weibo);

    @Select("select id,content,created,user_id userId from weibo where id=#{id}")
    Weibo selectById(Integer id);

    @Select("select id,content,created,user_id userId from weibo")
    List<Weibo> selectAll();
}
